import Vue from "vue";

import "normalize.css/normalize.css"; // A modern alternative to CSS resets

import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import locale from "element-ui/lib/locale/lang/en"; // lang i18n

import "@/styles/index.scss"; // global css

import App from "./App";
import store from "./store";
import router from "./router";

import "@/icons"; // icon
import "@/permission"; // permission control

// npm install d3 --save-dev

// zm-tree-org 基于 https://github.com/hukaibaihu/vue-org-tree
// npm install zm-tree-org --save
// https://gitee.com/sangtian152/zm-tree-org/tree/master
import ZmTreeOrg from "zm-tree-org";
import "zm-tree-org/lib/zm-tree-org.css";

// bin-tree-org
// npm i bin-tree-org -S
// https://gitee.com/wangbin3162/bin-tree-org/
// https://gitee.com/wangbin3162/bin-ui
import BinTreeOrg from "bin-tree-org";
// 需要引入样式文件，官方文档为说明，不知道是否有其他使用方式。
import "bin-tree-org/lib/styles/index.css";

// import BMode from "bin-ui";
// import DemoNode from "bin-ui";
// import "bin-ui/lib/styles/index.css";

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
if (process.env.NODE_ENV === "production") {
  const { mockXHR } = require("../mock");
  mockXHR();
}

// set ElementUI lang to EN
Vue.use(ElementUI, { locale });
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)
// 需要注册全局组件，否则使用时，提示找不到 b-tree-org 组件
Vue.component("b-tree-org", BinTreeOrg);

// Vue.component("b-tree-org", BigTree);
// Vue.component("b-mode", BMode);
// Vue.component("demo-node", DemoNode);

// bin-tree-org
Vue.use(BinTreeOrg);

// Vue.use(BigTree);
// Vue.use(BMode);
// Vue.use(DemoNode);

// zm-tree-org
Vue.use(ZmTreeOrg);

Vue.config.productionTip = false;

new Vue({
  el: "#app",
  router,
  store,
  render: (h) => h(App),
});
